/*
@Copyright:LintCode
@Author:   tjyemail
@Problem:  http://www.lintcode.com/problem/compare-strings
@Language: C++
@Datetime: 16-02-09 04:46
*/

class Solution {
public:
    /**
     * @param A: A string includes Upper Case letters
     * @param B: A string includes Upper Case letter
     * @return:  if string A contains all of the characters in B return true 
     *           else return false
     */
    bool compareStrings(string A, string B) {
        // write your code here
        int hash[256]={0};
        for(int i=0;i<A.length();++i)
            hash[A[i]]++;
        for(int i=0;i<B.length();++i)
            if (hash[B[i]]<1)
                return false;
            else
                hash[B[i]]--;
        return true;
    }
};
